
<!-- NAVBAR
    ================================================== -->
<div class="navbar navbar-inverse navbar-fixed-top">
    <div class="navbar-inner">
        <div class="container">
            <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="brand" href="<?php echo base_url(); ?>">Together</a>
            <div class="nav-collapse collapse " id="menu">
                <ul class="nav" >
<!--                    <span></span>-->
                       <li>
                    <a class="" href="<?= $createEventUrl ?>">Đăng tin</a>
                    </li>
                    <li >
                        <form class="form-search navbar-form pull-left">
                            <div class="input-append">
                                <input type="text" class="span5 search-query ">
                                <button type="submit" class="btn">Tìm kiếm</button>
                            </div>
                        </form>
                    </li>
                    <li>
                        <a href="<?php echo base_url()."/index.php/event/list_event"; ?>">Mới</a>
                        
                    </li>
                    <li>
                        <a href="<?php echo base_url()."/index.php/event/list_event"; ?>">Hót</a>
                    </li>
                    <li >
                        <a href="<?= $chatUrl ?>">Chat</a>
                    </li>
                    
                    <?php
                    $is_login = is_login();
                    if ($is_login == True) {
                        ?>
                        <li class="dropdown">
                             <a class="dropdown-toggle" data-toggle="dropdown"  href="">
                                 <?php  $uin = current_user_info();
                                    if($uin!=null){
                                        echo $uin["username"];
                                    }else{
                                        echo "together username";
                                    }
                                 ?>
                                
                                <span class="caret"></span>
                              
                            </a>
                              <ul class="dropdown-menu">
                                    <li><a tabindex="-1" href="#">Sự kiện</a></li>
                                     <li><a tabindex="-1" href="#">Nhật kí</a></li>
                                    <li><a tabindex="-1" href="<?php echo base_url()."index.php/user/profile"?>">Cá nhân</a></li>
                                    <li><a tabindex="-1" href="#">Album</a></li>
                                    <li><a tabindex="-1" href="#" id="logout">Thoát</a></li>
                                </ul>

                        </li>
                        <?php
                    } else {
                        ?>     
                        <li class="pull-right">
                            <a class="" href="<?= $loginUrl ?>" >Đăng nhập</a>
                        </li>
<!--                         <li class="pull-right">
                            <a class="" href="<?= $registerUrl ?>" style="color: white !important; ">Đăng kí</a>
                        </li>-->
                        <?php
                    }
                    ?>

                </ul>
            </div><!--/.nav-collapse -->
        </div>
    </div>
</div>

<script>
$(document).ready(function(){
    $("#logout").click(function(){
        jQuery.ajax({
            type :"POST",
            url  :"<?php echo base_url(); ?>index.php/user/logout" ,
           data :{"exit":"true"},

            cache: false, 
            success:function(data){
               window.location.href = "<?php echo base_url(); ?>";
            }
        });
    });
});


</script>
